home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 September
/
1987-09.d64
/
exercise pacer
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
7KB
|
197 lines
10 rem copyright 1987 compute! publications inc. - all rights reserved
20 poke53280,11:poke53281,0
30 printchr$(142)chr$(8)"[147][158] copyright 1987 compute! pub., inc."
40 printtab(10)"all rights reserved":print"reading data..."
50 fori=1to332:reada:x=x+a:next:ifx<>42309thenprint"data statement error.":stop
60 dimx(201),na$(201),tl$(201):open15,8,15:v=53248:restore
70 poke54296,15:poke54272,132:poke54273,225:poke54277,0:poke54278,240
80 poke54279,134:poke54280,33:poke54284,15:poke54285,250
90 poke54286,106:poke54287,110:poke54291,30:poke54292,0
100 fors=832to894:readd1:pokes,d1:next:fors=896to958:readd2:pokes,d2:next
110 poke2040,13:poke2041,14:pokev+29,3:pokev+23,3:pokev+39,4:pokev+40,4
120 pokev+16,3:pokev+0,20:pokev+2,20:pokev+1,138:pokev+3,138
130 form=49152to49357:readd3:pokem,d3:next
140 input"[147]enter time of day (hhmm)";a$:ifval(a$)>1259orlen(a$)<4then140
150 h1=val(left$(a$,1)):h2=val(mid$(a$,2,1))
160 m1=val(mid$(a$,3,1)):m2=val(right$(a$,1))
170 print""left$(a$,2)":"right$(a$,2)
180 print"is this ok (y/n)?"
190 getd$:ifd$=""ord$<>"n"andd$<>"y"then190
200 ifd$="n"then140
210 poke56331,(h1*16)+h2:poke56330,(m1*16)+m2:poke56329,0:poke56328,0
220 iffl=1then1320
230 poke650,128:gosub240:goto310
240 ln$(1)="[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
250 ln$(2)=" [158][164][164][164][164][164][164]":ln$(3)=" [163][163][163][163][163][163]"
260 print"[147][150][178]"ln$(1)"[178]";
270 print"[150][221] [155]exercise pacer[150] [221]";
280 print"[150][177]"ln$(1)"[177]";:return
290 println$(2):print" [167][205][164][164][164][164][206][165]":return
300 print" [167][206][163][163][163][163][205][180]":println$(3):return
310 gosub290:print" [167][167] f1 [165][180] enter exercises/save":gosub300
320 gosub290:print" [167][167] f3 [165][180] recall program/edit/run":gosub300
330 gosub290:print" [167][167] f5 [165][180] format diskette":gosub300
340 gosub290:print" [167][167] f7 [165][180] exit exercise pacer":gosub300:gosub1710
350 getd$:ifd$=""then350
360 d=asc(d$)-132:ifd<1ord>4then350
370 ondgoto530,890,380,480
380 print"[147]you have chosen to format a data"
390 print"diskette. are you sure you want to do this (y/n)?":gosub1710
400 getd$:ifd$=""ord$<>"y"andd$<>"n"then400
410 ifd$="n"then220
420 print"[147]insert your disk into the disk drive."
430 print"press _ to start formatting.":gosub1710
440 getd$:ifd$<>"_"then440
450 print#15,"n0:exercise data,01"
460 print"[147][159]...formatting diskette"
470 gosub1660:goto220
480 print"[147]you have chosen to exit the program."
490 print"are you sure you want to do this (y/n)?":gosub1710
500 getd$:ifd$=""ord$<>"y"andd$<>"n"then500
510 ifd$="n"then220
520 close15:print"[147]":end
530 na$="":print"[147]name of exercise program:":inputna$:ifna$=""then220
540 iflen(na$)>12then530
550 print"[147]":nu=1
560 ifnu=200then660
570 print"event #"nu"name (enter end[146] to stop):":inputna$(nu)
580 iflen(na$(nu))>35then570
590 ifna$(nu)="end"thenna$(nu)="":x=nu-1:goto660
600 print"[158]time limit for event #"nu"(mmss):":inputtl$(nu)
610 iflen(tl$(nu))>4then600
620 print"[154]any mistakes (y/n)?":gosub1710
630 getd$:ifd$=""ord$<>"y"andd$<>"n"then630
640 ifd$="y"then570
650 nu=nu+1:goto560
660 print"[147]exercise program:"na$:print"number of events:"x
670 print"insert your data diskette into"
680 print"the drive. press _ when ready.":gosub1710
690 getd$:ifd$<>"_"then690
700 print"[147][159]...saving data"
710 open1,8,5,"0:"+na$+",s,w":fornu=1tox:print#1,na$(nu):print#1,tl$(nu):next
720 print#1:close1:open1,8,5,"0:"+na$+".idx,s,w":print#1,x:print#1:close1
730 gosub1660:ife<>63then850
740 print"[147]a file with the same name as[159]"
750 printna$" exists on the disk."
760 print"do you wish to replace the old file"
770 print"with the new (y/n)?":gosub1710
780 getd$:ifd$=""ord$<>"y"andd$<>"n"then780
790 ifd$="n"then820
800 print"[147][159]...erasing old file"
810 print#15,"s0:"+na$:print#15,"s0:"+na$+".idx":goto700
820 print"[147]enter new name for program:":gosub1710:inputna$
830 iflen(na$)>12then820
840 goto700
850 print"[147]do you wish to repeat save (y/n)?":gosub1710
860 getd$:ifd$=""ord$<>"y"andd$<>"n"then860
870 ifd$="y"then660
880 ifd$="n"then220
890 print"[147]place your exercise data diskette"
900 print"into the disk drive. enter the"
910 print"workout program you want to recall.":gosub1710
920 na$="":inputna$:ifna$=""then220
930 iflen(na$)>12then920
940 print"[147][159]...recalling file"
950 open1,8,5,"0:"+na$+".idx,s,r":input#1,x:close1
960 open1,8,5,"0:"+na$+",s,r":fornu=1tox:input#1,na$(nu),tl$(nu):next:close1
970 gosub1660:ife<>0then220
980 print"[147]press [158]r[146] to run pacer"
990 print" [158]e[146] to edit/review program.":gosub1710
1000 getd$:ifd$=""ord$<>"r"andd$<>"e"then1000
1010 ifd$="r"then1320
1020 nu=1
1030 print"[147][159]program: "na$:print"number of events: "x
1040 print"event name:":print""na$(nu)
1050 print"event number:":print""nu
1060 print"[158]time limit:":print""tl$(nu)
1070 print"press <f1> to see first event"
1080 print"press <f3> to see next event"
1090 print"press <f5> to see previous event"
1100 print"press <f7> to see last event"
1110 print"press <a> to add additional events"
1120 print"press <e> to edit"
1130 print"[154]press <r> to run pacer"
1140 print"press <m> to go back to main menu.":gosub1710
1150 getd$:ifd$=""then1150
1160 ifd$="[133]"thennu=1:goto1030
1170 ifd$="[134]"andnu<>400andnu<xthennu=nu+1:goto1030
1180 ifd$="[135]"andnu<>1thennu=nu-1:goto1030
1190 ifd$="[136]"thennu=x:goto1030
1200 ifd$="a"thennu=x+1:goto570
1210 ifd$="e"then1270
1220 ifd$="r"andfg=1thenfl=1:fg=0:goto660
1230 ifd$="m"andfg=1thenfg=0:goto660
1240 ifd$="r"then1320
1250 ifd$="m"then220
1260 goto1150
1270 fg=1:input"enter new name:";na$(nu)
1280 iflen(na$(nu))>35then1270
1290 input"[158]enter new time limit (mmss):";tl$(nu)
1300 iflen(tl$(nu))>4then1290
1310 goto1030
1320 fl=0:fg=0:print"[147]"
1330 print" press space bar to start pacer!":d=200:gosub1760
1340 getd$:ifd$=chr$(32)then1370
1350 print" press space bar to start pacer!":d=200:gosub1760
1360 goto1330
1370 gosub1740:poke650,0:dm=fre(0):sys49152:fornu=1tox:cg=0
1380 print"[147][158]time of day: "
1390 print"[158]exercise:":print" "na$(nu)
1400 print"[158]event #:"nu:print"[158]events to go:"x-nu
1410 print"[158]time limit: "mid$(tl$(nu),1,2)":"mid$(tl$(nu),3,2)
1420 print"[158]time elapsed: ":poke56587,0:poke56586,0:poke56585,0:poke56584,0
1430 print"[158]up next:":print" [153]"na$(nu+1)
1440 printspc(9)"[159]press <space> to pause"
1450 printspc(4)"press <^> to jump to next event"
1460 printspc(2)"keep pressing <_> to abort exercise"
1470 gosub1510:gosub1570
1480 getd$:ifd$="_"thengosub1550:goto220
1490 ifcg=1thennext:goto1560
1500 goto1470
1510 zf=0:forz=1to4:ifpeek(1019+z)-48<>val(mid$(tl$(nu),z,1))thenzf=1
1520 next:ifzfthenreturn
1530 gosub1720:cg=1:return
1540 goto1390
1550 poke56333,127:poke788,49:poke789,234:poke56333,129:return
1560 gosub1550:print"[147] you're done!":gosub1740:goto220
1570 getd$:ifd$=""thenreturn
1580 ifd$=chr$(32)then1610
1590 ifd$="^"thencg=1:return
1600 return
1610 poke198,0
1620 poke56587,0:poke56586,(peek(1020)-48)*16+peek(1021)-48
1630 poke56585,(peek(1022)-48)*16+peek(1023)-48
1640 getd$:ifd$<>chr$(32)then1620
1650 poke56584,0:return
1660 input#15,e,e$:ife=0thenreturn
1670 print"[147][159]disk status:":print"[154]number","error":print"[153]"e,e$
1680 print"press c to continue.":gosub1710
1690 getd$:ifd$<>"c"then1690
1700 return
1710 poke54276,17:d=200:gosub1760:poke54276,16:return
1720 forr=1to5:poke54283,33:pokev+21,1:d=800:gosub1760
1730 pokev+21,2:poke54283,32:d=800:gosub1760:next:pokev+21,0:return
1740 forr=1to40:poke54290,21:d=50:gosub1760:poke54290,20:d=50:gosub1760:next
1750 return
1760 fory=1tod:next:return
1770 data255,255,255,255,255,255,255,255,255,224,0,7,224,60,7,224
1780 data60,7,226,60,71,225,24,135,224,153,7,224,126